/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.vraptor.jpessoal.bean;

import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.ioc.SessionScoped;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
import javax.servlet.http.HttpSession;


@Component
@SessionScoped
public class ObjSession {
    private HttpSession session;
    
   public ObjSession (HttpSession session){
       
       this.session = session;
       
   }

    public void setSession(Colaborador colaborador) {
        this.session.setAttribute("obj",colaborador);
    }
     public Colaborador getSession(){
        return (Colaborador) this.session.getAttribute("obj");
    }
     public void invalidar(){  
        this.session.setMaxInactiveInterval(0);
        
    } 
     
      public Timestamp getDataAtual(){
       
        Calendar calendar = Calendar.getInstance();
       
        Date now = calendar.getTime();
       
        Timestamp currentTimestamp = new Timestamp(now.getTime());
        
        return currentTimestamp;
    }
   
}

